<?php

namespace app\index\controller\rank;

use ShidianUtil\Thinkphp\Response\ApiResponse;
use ShidianUtil\Utils\CheckUtil;
use app\index\model\UM as UM;
use app\index\service\HotRankInfoService;
use think\APP;
use think\Request as Request;

/**
 * Info 控制器
 * Class Info
 * @package app\index\controller\rank;
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037509
 * @see \app\index\validate\rank\Info
 */
class Info
{
    // 请求参数
    private Request $request;

    // service
    private HotRankInfoService $service;

    public function __construct(Request $request, HotRankInfoService $infoService)
    {
        $this->request = $request;
        $this->service = $infoService;
    }


    /**
     * 详情
     * @param UM|null $user
     * @return ApiResponse
     * @url /rank/info/read
     */
    public function read(?UM $user): ApiResponse
    {
        $request     = $this->request;

        return ApiResponse::success($this->service->read($user));
    }

}
